//
//  ZYCStudentLeaveCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/27.
//

#import "ZYCStudentLeaveCell.h"
@interface ZYCStudentLeaveCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UILabel *line;
@property (nonatomic, strong) UITextField *textField;
@end

@implementation ZYCStudentLeaveCell

- (void)setDict:(NSDictionary *)dict{
    _dict = dict;
    _titleLabel.attributedText = [self returnStringWithString:dict[@"title"]];
    _textField.placeholder = dict[@"placeHolder"];
}

- (NSMutableAttributedString *)returnStringWithString:(NSString *)string{
    NSMutableAttributedString * attriString = [[NSMutableAttributedString alloc] initWithString:string];
    [attriString addAttribute:NSForegroundColorAttributeName value:HEX_RGB(kTitleRedColor) range:NSMakeRange(0, 1)];
    return attriString;
}


- (void)setContentSting:(NSString *)contentSting{
    _contentSting = contentSting;
    _textField.text = contentSting;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.textField];
        [self.contentView addSubview:self.arrowImageView];
        [self.contentView addSubview:self.line];
    
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.arrowImageView.mas_left).offset(-10.0f);
            make.centerY.equalTo(self.contentView);
        }];

        [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(9, 16));
        }];
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self.contentView);
            make.height.mas_equalTo(1);
        }];
        

    }
    return self;
}

- (UIImageView *)arrowImageView {
    if (!_arrowImageView) {
        _arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"jt"]];
    }
    return _arrowImageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 16.0f) titleColor:HEX_RGB(@"#2B302D") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}


- (UITextField *)textField {
    if (!_textField) {
        _textField = [[UITextField alloc] init];
        _textField.enabled = NO;
        _textField.font = kCustomFont(@"PingFangSC-Light", 16.0f);
        _textField.textColor = HEX_RGB(@"#2B302D");
        _textField.textAlignment = NSTextAlignmentRight;
    }
    return _textField;
}


- (UILabel *)line {
    if (!_line) {
        _line = [[UILabel alloc] init];
        _line.backgroundColor = HEX_RGB(@"#F9F9F9");
    }
    return _line;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
